package com.sos.data.filters
{
	import com.sos.core.School;
	import com.sos.core.cards.Card;
	
	
	public class SchoolsFilter extends DataFilter
	{
		public function SchoolsFilter(name:String, value:Object)
		{
			super(name, "schools", value);
		}
		
		// -------------------------------------------------------------------------------
		// PUBLIC METHODS
		// -------------------------------------------------------------------------------
		
		/**
		 * Evaluate the filter using the given object 
		 * @param obj Object to evaluate with the filter
		 * @return True if the given object is not null, has a the 'field' and the 'field' is
		 * strict equal to 'value'
		 */		
		override public function evaluate(obj:Object):Boolean
		{
			return 	obj != null &&
					obj.hasOwnProperty(_field) &&
					obj is Card &&
					(obj as Card).hasSchool(value as School);
		}
		
	}
}